package com.rui.shiliao;

import java.util.List;
import java.util.Map;

import net.youmi.android.appoffers.AppOffersActivity;
import net.youmi.android.appoffers.AppOffersManager;
import net.youmi.android.spotad.AdActivityListener;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;

import com.cxj.shiliao.R;
import com.rui.shiliao.util.XmlUtil;
import com.waps.AppConnect;

public class ShiLiaoActivity extends SLAppActivity {
    public static Map<String, Map<String, List<String>>> worlds;
    private Button moreButton;
    private boolean showButton = false;
    private Thread thread;
    private ArrayAdapter<Object> typeAdapter;

    public void onCreate(Bundle paramBundle) {
        super.onCreate(paramBundle);
        setContentView(R.layout.main);
        initAdContext(ShiLiaoActivity.this);
        
        worlds = XmlUtil.parse(this, "EatWorld.xml", "EatWorld");
        this.typeAdapter = new ArrayAdapter(this, R.layout.spinner_item, worlds.keySet().toArray());
        ListView localListView = (ListView) findViewById(R.id.listView1);
        localListView.setAdapter(this.typeAdapter);
        localListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            public void onItemClick(AdapterView<?> paramAdapterView, View paramView, int paramInt, long paramLong) {
                Object localObject = ShiLiaoActivity.this.typeAdapter.getItem(paramInt);
                Intent localIntent = new Intent(ShiLiaoActivity.this, ViewActivity.class);
                localIntent.putExtra("title", localObject.toString());
                ShiLiaoActivity.this.startActivity(localIntent);
            }
        });
        localListView.setOnTouchListener(new View.OnTouchListener() {
            public boolean onTouch(View paramView, MotionEvent paramMotionEvent) {
                ShiLiaoActivity.this.showButton = true;
                return false;
            }
        });
        this.moreButton = ((Button) findViewById(R.id.button_More));
        this.moreButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View paramView) {
                AppOffersManager.showAppOffers(ShiLiaoActivity.this);
            }
        });
        new Thread() {
            public void run() {
                try {
                    sleep(5000L);
                    ShiLiaoActivity.this.handler.post(new Runnable() {
                        public void run() {
                            ShiLiaoActivity.this.findViewById(R.id.linearLayout_Logo).setVisibility(8);
                            ShiLiaoActivity.this.findViewById(R.id.relativeLayout_Main).setVisibility(0);
                        }
                    });
                    return;
                } catch (InterruptedException localInterruptedException) {
                    while (true)
                        localInterruptedException.printStackTrace();
                }
            }
        }.start();
        
        startPointThread(this);
        setAdLayout((LinearLayout) findViewById(R.id.linearLayout_Ad));
    }

    protected void onDestroy() {
        super.onDestroy();
        AppConnect.getInstance(this).finalize();
        this.thread.interrupt();
        worlds = null;
    }

    public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent) {
        if (paramInt == 4)
            new AlertDialog.Builder(this).setTitle("要退出" + getResources().getString(R.string.app_name) + "吗？")
                    .setPositiveButton("确定", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface paramDialogInterface, int paramInt) {
                            paramDialogInterface.dismiss();
                            ShiLiaoActivity.this.finish();
                        }
                    }).setNegativeButton("取消", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface paramDialogInterface, int paramInt) {
                            paramDialogInterface.dismiss();
                        }
                    }).create().show();
        for (boolean bool = true;; bool = super.onKeyDown(paramInt, paramKeyEvent))
            return bool;
    }

    protected void onResume() {
        super.onResume();
        if (this.thread == null) {
            this.thread = new Thread() {
                public void run() {
                    try {
                        while (true) {
                            if (!ShiLiaoActivity.this.showButton) {
                                sleep(50L);
                                continue;
                            }
                            ShiLiaoActivity.this.handler.post(new Runnable() {
                                public void run() {
                                    ShiLiaoActivity.this.moreButton.setVisibility(0);
                                }
                            });
                            sleep(5000L);
                            ShiLiaoActivity.this.handler.post(new Runnable() {
                                public void run() {
                                    ShiLiaoActivity.this.moreButton.setVisibility(8);
                                }
                            });
                        }
                    } catch (InterruptedException localInterruptedException) {
                    }
                }
            };
            this.thread.setDaemon(true);
            this.thread.start();
        }
    }
}

/* Location:           F:\temp\tools\classes_dex2jar.jar
 * Qualified Name:     com.rui.shiliao.ShiLiaoActivity
 * JD-Core Version:    0.6.0
 */